package se.thoka.twt.client.utils.validation;

public class DoubleOrNullValidation implements Validation {

	@Override
	public String getDescription() {
		return ValidationUtil.getStrings().invalidDouble();
	}
	
	@Override
	public boolean validate(String value) {
		boolean valid;
		if (value != null) {
			try {
				Double.parseDouble(value);
				valid = true;
			} catch (NumberFormatException e) {
				valid = false;
			}
		} else {
			valid = true;
		}
		
		return valid;
	}
}
